//
//  ThemeManager.h
//  kabu
//
//  Created by XiangDongMBP on 2017/4/11.
//  Copyright © 2017年 East. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSInteger, ThemeState) {
    ThemeStateNotDownload = 0,  //!< 未下载
    ThemeStateHasDownload,      //!< 已经下载
    ThemeStateIsUsed,           //!< 正在使用
};

// 通知
extern NSNotificationName const ThemeManagerThemeDidChangedNotification;
// 属性字典的Key
extern NSString *const ThemeManagerNavBgColor;      //!< 导航栏的背景颜色
extern NSString *const ThemeManagerMineBgColor;     //!< 个人中心的背景颜色
extern NSString *const ThemeManagerNavTintColor;    //!< 导航栏的前景颜色
extern NSString *const ThemeManagerTabBarTintColor; //!< 底部TabBar的前景颜色
extern NSString *const ThemeManagerCosSelBgColor;   //!< Cosplay页面选择cos类型的背景色
extern NSString *const ThemeManagerCosSelTintColor; //!< Cosplay页面选择cos类型的蒙层颜色
extern NSString *const ThemeManagerMallSeaBgColor;  //!< 商城顶部搜索栏的背景色
extern NSString *const ThemeManagerMallSeaTextColor;//!< 商城顶部搜索栏TextField的text的颜色
extern NSString *const ThemeManagerMallSeaPlaceholderColor;     //!< 商城顶部搜索栏TextField的placeholder的颜色
extern NSString *const ThemeManagerMallSeaTextFieldTintColor;   //!< 商城顶部搜索栏TextField的光标的颜色

@interface ThemeManager : NSObject

@property (nonatomic, readonly) NSInteger curThemeId;   //!< 当前主题的Id

+ (instancetype)sharedManager;
- (void)setLaunchTheme;
- (void)changeThemeWithThemeId:(NSInteger)themeId;
- (BOOL)themeExistWithThemeId:(NSInteger)themeId;
- (ThemeState)themeStateWithThemeId:(NSInteger)themeId;
- (void)deleteThemeWithThemeId:(NSInteger)themeId;
- (UIImage *)themeImageWithName:(NSString *)imgName;
- (UIColor *)themeColorWithName:(NSString *)colorName;
- (void)downloadThemePackageWithThemeId:(NSInteger)themeId
                                 zipUrl:(NSString *)url
                               progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgressBlock
                      completionHandler:(nullable void (^)(NSURLResponse *response, NSURL * _Nullable filePath, NSError * _Nullable error))completionHandler;
@end
NS_ASSUME_NONNULL_END
